package com.epam.tcs.dao.hibernate.entities;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import java.io.Serializable;
import java.util.Date;

@Entity
@Table(name = "tcs_journal_practices")
public class JournalPracticeStatus  implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -2349001840876683187L;
	private Long journal_practice_status_id;
	private Date date_giving_task;
	private Date date_pass_task;

	private Practice practice;
	private PracticeStatus practiceStatus;
	private Student student;

	public JournalPracticeStatus(Date date_giving_task, Date date_pass_task,
			Practice practice, PracticeStatus practiceStatus, Student student) {
		this.date_giving_task = date_giving_task;
		this.date_pass_task = date_pass_task;
		this.practice = practice;
		this.practiceStatus = practiceStatus;
		this.student = student;
	}

	@Id
	@Column(name = "journal_practice_status_id")
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getJournal_practice_status_id() {
		return journal_practice_status_id;
	}

	public void setJournal_practice_status_id(Long journal_practice_status_id) {
		this.journal_practice_status_id = journal_practice_status_id;
	}

	@Column(name = "date_giving_task")
	@Temporal(value = TemporalType.TIMESTAMP)
	public Date getDate_giving_task() {
		return date_giving_task;
	}

	public void setDate_giving_task(Date date_giving_task) {
		this.date_giving_task = date_giving_task;
	}

	@Column(name = "date_pass_task")
	@Temporal(value = TemporalType.TIMESTAMP)
	public Date getDate_pass_task() {
		return date_pass_task;
	}

	public void setDate_pass_task(Date date_pass_task) {
		this.date_pass_task = date_pass_task;
	}

//	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinColumn(name = "lec_prac_id", nullable = false)
	public Practice getPractice() {
		return practice;
	}

	public void setPractice(Practice practice) {
		this.practice = practice;
	}

//	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinColumn(name = "student_practice_status", nullable = false)
	public PracticeStatus getPracticeStatus() {
		return practiceStatus;
	}

	public void setPracticeStatus(PracticeStatus practiceStatus) {
		this.practiceStatus = practiceStatus;
	}

//	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinColumn(name = "student_id", nullable = false)
	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}
}
